<?php
/**
 * Created by jinqiang on 2024/9/5 17:15.
 * Copyright (c) 2024, Your Company. All rights reserved.
 */


namespace App\Http\Controllers\Soa;


use App\Http\Controllers\Controller;
use App\Http\Services\Soa\CyStatisticService;
use Illuminate\Http\Request;

class CyStatisticController extends Controller
{
    public function list(Request $request, CyStatisticService $cyStatisticService)
    {
        $this->validate($request, [
            'page' => 'required',
            'limit' => 'required',
            'date' => 'required'
        ]);
        $param = $request->all();
        $res = $cyStatisticService->search($param);
        return result($res);
    }

    //价格不变批量提交
    public function submit(Request $request, CyStatisticService $cyStatisticService)
    {
        $this->validate($request, [
            'processing_codes' => 'required'
        ]);
        $param = $request->all();
        $res = $cyStatisticService->submit($param['processing_codes']);
        return $res['code'] === 0 ? success($res['msg']) : error($res['msg'], $res);
    }
}
